import prisma from '@/server/lib/prisma';

export default defineEventHandler(async (event) => {
  try {
    const query = getQuery(event);
    const result = await prisma.sys_user.delete({
      where: {
        userId: Number(query.userId)
      },
      select: {
        userId: true,
        userName: true,
      }
    })
    
    return {
      code: 200,
      data: result,
      msg: '删除成功'
    }
  } catch (e) {
    throw e;
  } finally {
    await prisma.$disconnect();
  }
})